package com.hd.service.test;

import java.util.Calendar;
import java.util.List;

import com.hd.common.DataPage;
import com.hd.persistence.model.ReturnRecord;
import com.hd.utils.HdException;

public class ReturnRecordManagerTestCase extends BaseTest {
	
	//保存实体
//	public void testSaveReturnRecord() throws HdException {
//		for ( int i = 0; i < 10; i++ ) {
//			ReturnRecord returnRecord = new ReturnRecord();
//			returnRecord.setUnitName("单位名称" + i);
//			returnRecord.setContactor("唐僧");
//			returnRecord.setContactWay("0510-85910687");
//			returnRecord.setMachineNo("26543215"+i);
//			returnRecord.setMachineModel("OOXX"+i);
//			returnRecord.setThisTimeRepairman("维修员" + i);
//			returnRecord.setThisTimeContent("检查检查");
//			returnRecord.setThisTimeRepairDate(new Date());
//			returnRecord.setIsReplaceCarbonPowder(true);
//			returnRecord.setIsReplacePart(true);
//			returnRecord.setCreateTimestamp(123456);
//			repairManager.saveReturnRecord(returnRecord);
//		}
//	}
	
	//分页查询回访记录
//	public void testPageQueryReturnRecords() throws HdException {
//		DataPage<ReturnRecord> dataPage = repairManager.pageQueryReturnRecords(1, 10);
//		System.out.println("查询总数为:" + dataPage.getTotalCount());
//		List<ReturnRecord> returnRecords = dataPage.getData();
//		for ( ReturnRecord returnRecord : returnRecords ) {
//			System.out.println(returnRecord.getReturnRecordId() + " " + returnRecord.getUnitName());
//		}
//	}
	
	//根据条件分页查询
	public void testPageQueryReturnRecords2() throws HdException {
		Calendar c = Calendar.getInstance();
		c.set(Calendar.MONTH, 2);
		c.set(Calendar.DAY_OF_MONTH, 26);
		c.set(Calendar.HOUR_OF_DAY, 0);
		c.set(Calendar.MINUTE, 0);
		c.set(Calendar.SECOND, 0);
		c.set(Calendar.MILLISECOND, 0);
		DataPage<ReturnRecord> dataPage = repairManager.pageQueryReturnRecords("单位名称0", "OOXX0", "维修员0", c.getTime(), 1, 100);
		System.out.println("查询总数为:" + dataPage.getTotalCount());
		List<ReturnRecord> returnRecords = dataPage.getData();
		for ( ReturnRecord returnRecord : returnRecords ) {
			System.out.println(returnRecord.getReturnRecordId() + " " + returnRecord.getUnitName());
		}
	}

}
